﻿using FluentParser.Expressions;
using FluentParser.Expressions.Terminals.Parsing;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace FluentParser.Tests.Expressions.Rules.Decoration
{
    [TestClass]
    public class CastToExpressionRuleTests
    {
        [TestMethod]
        public void Parse_WhenConvertingToExpression_ShouldReturnTheSameValueAsDecoratedExpression()
        {
            Symbol source = "SomeText";
            Expr<object> expr = source.ToExpr();

            var expected = source.Parse("SomeText").Value;
            var actual = expr.Parse("SomeText").Value;

            Assert.AreEqual(expected, actual);

            expected = source.Parse("SomeOtherText");
            actual = expr.Parse("SomeOtherText");

            Assert.AreEqual(expected, actual);
        }
    }
}
